#ifndef GLOBALSIGNALMGR_H
#define GLOBALSIGNALMGR_H

#include <QObject>
#include <QMutex>
#include <QList>

class obSrverApater;

class SignalType{
public:
    //主控窗口
    const static QString SIG_SET_STATUS;
    const static QString SIG_SET_FLODER;
    const static QString SIG_FILEBROWSER_SHOWORHID_VOID;
    const static QString SIG_RELAYOUT_WINDOW;
    const static QString SIG_SEARCH_FORM_OPEN_VOID;
    //browser对editerbar
    const static QString SIG_FILE_ADD_EDIT_STRING;
    const static QString SIG_FILE_NAME_CHANGED_STRING;
    //editer_bar交互editer
    const static QString SIG_FILE_CLOSE_CHECK_CHANGE_STRING;
    const static QString SIG_FILE_SAVE_SINGLE_VOID;
    const static QString SIG_FILE_SAVE_ALL_VOID;
    const static QString SIG_FILE_CLOSE_ALL_VOID;
    const static QString SIG_FILE_CLOSE_ONE_VOID;
};

struct relationData{
    QString type;
    QObject* receiver;
    obSrverApater* ob;
};

class obSrverApater : public QObject{
    Q_OBJECT
public:
    explicit obSrverApater();
signals:
    void notify(QString datas);
    void notify();

};
class GlobalSignalMgr:public QObject
{
    Q_OBJECT
private:
    static GlobalSignalMgr* m_instance_ptr;
    GlobalSignalMgr(QObject* parent=nullptr);
    GlobalSignalMgr(GlobalSignalMgr&)=delete;
    GlobalSignalMgr& operator=(const GlobalSignalMgr&)=delete;
    ~GlobalSignalMgr();

public:

    static GlobalSignalMgr* get_instance();
    void attach(const QString& type, QObject* receiver, const char* method);
    void detach(const QString& type, const QObject* receiver);
    void notify(const QString& type, QString data);
    void notify(const QString& type);
private:
    QList<relationData*> m_oRelationList;
signals:


public slots:
};

#endif // GLOBALSIGNALMGR_H
